<?php 
@session_start();
/*error_reporting(E_ALL);
ini_set('display_errors','On');*/

require_once 'cls/security/functions.php';

if (isset($_GET['gestion'])){
	if ($_GET['gestion']=='logout')
	disconnect();
} 

//vérifier les données postés
if(!isset($_SESSION["isConnected_appproj"])){
	verifLogin();
	//	echo " okkkkkkkkkkkkkkkk1".$_SESSION['cin'];

	//echo $_SESSION['cin'];
}

if (verifConnect())
{
	header('Content-type: text/html; charset=utf-8');
//echo " okkkkkkkkkkkkkkkk2".$_SESSION['cin'];
	$_racine_config='cls/config/';
	
	//inclusion de la configuration
	require_once($_racine_config.'config.php');

	require_once(RACINE_USER."user.cls.php");

	//appel des classes de mvc
	require_once(RACINE_MVC.'controller.class.php');
	require_once(RACINE_MVC.'view.class.php');
	require_once(RACINE_MVC.'register.class.php');
	

	if(isset($_GET['gestion']) && !empty($_GET['gestion'])){
		$action = $_GET['gestion'];
	}else{
		
	//	echo " okkkkkkkkkkkkkkkk3".$_SESSION['cin'];
		$action = 'accueil';
	}
	

	$contrl= new controller();
	$contrl->call($action,$_SESSION['cin']);
}else
{
	include "views/login.php";
}

 ?>

